<template>
  <div class="page-header">
    <div class="left-back" v-if="showBack" @click="$router.back()">
      <span class="iconfont">&#xe665;</span>
      返回
    </div>
    <span class="title-text">{{ title }}</span>
    <div class="right-menu">
      <span
        class="iconfont"
        v-if="!$store.state.isLogin"
        @click="$router.push({ name: 'Login' })"
        >&#xe614;</span
      >
    </div>
  </div>
</template>

<script>
export default {
  name: "PageHeader",
  props: {
    title: {
      type: String,
      default: "软底点餐",
    },
    showBack: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style lang="scss" scoped>
.page-header {
  @include flexbox(row, center, center);
  height: 45px;
  background-color: $primaryColor;
  color: white;
  position: relative;
  .left-back{
      position: absolute;
      left: 10px;
  }
  .right-menu{
      @extend .left-back;
      left:unset;
      right:10px;
  }
}
</style>